package com.feiyangedu.time;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

public class Format {
    public static void main(String[] args) {
        DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
        System.out.println(dtf.format(LocalDateTime.now()));
//        ISO格式
        LocalDateTime dt1 = LocalDateTime.parse("2016-11-11T12:09:09");
        System.out.println(dt1);
//        指定格式
        LocalDateTime dt2 = LocalDateTime.parse("2016-11-11 12:09:09", dtf);
        System.out.println(dt2);
    }
}
